1. Field of the Invention
The present invention relates generally to a method and apparatus for searching an electronically stored table of information including a plurality of table entries, and more specifically to a method and apparatus for facilitating high speed linear searching of a table by a plurality of agents that are each required to search many entries of the table using different search keys.
2. Description of the Related Art
In the fields of electronic data communications and data processing, electronically stored tables of information are used in vast variety of applications to provide a mapping between two or more information spaces. The tables of information, which include a plurality of entries, may be searched in accordance with many different methods.
Generally, a searching agent searches a table using a search key, and may read one or more tables entries to determine an exact match or a best match depending on the particular application requirements. It is a common design requirement that each of a plurality of searching agents having different search keys is required to search a single table of information. For applications in which it is generally not feasible to employ a multiplicity of memory devices storing the same table of information, an arbitration scheme is typically employed to resolve requests from each of the searching agents for access to the single table.
Many algorithms and devices have been developed to efficiently search tables of information. A basic brute force method is linear searching wherein a device searches a table linearly one entry at a time. Linear searching is the simplest search method, and it is ideal for searching small tables in applications having slow search requirements. However, linear searching becomes impractical as the table sizes increase because the maximum search time is proportional to the table size.
In order to shorten the table search time, binary searching methods may be used wherein all entries of the table are sorted in a particular order, and the search times are equal to log2 (table size). Binary searching methods are particularly desirable for searching large tables using software, but sorting the table entries in a particular order is not a simple task. Due to this high maintenance requirement, binary searching is often not feasible to implement in hardware.
One of the quickest methods of table searching uses content addressable memory (CAM) searching wherein all table entries are compared against a search key at the same time, and the search result is delivered to an output instantly. However, CAM searching provides high search performance at the expense of implementing greater logic using a greater amount of silicon real estate. Moreover, there is typically a limit to the size of comparison fields (i.e. data width) and the size of payload fields which may be used in CAM searching.
Some of the most common methods of table search employ hashing algorithms in which table entries are grouped into different buckets in accordance with the particular type of hashing algorithm (i.e. crc32). Searching systems employing hashing algorithms are capable of narrowing the searching area to a specific location (a bucket), and this limits the maximum searching time. The maximum table searching time is based on the size of the bucket, and the table search time remains constant as the number of buckets increases. As the number of the table entries increase, the possibility that two or more entries are hashed to a same bucket also increases. If the maximum table entry (the size of table) is considerably larger than the typical number of entries used at the same time and the hash algorithm spreads the entries evenly, there is a good chance that only one or two entries are in a bucket. In this case, the average search time will be rather short (one or two clock cycles per search). A good hash algorithm scatters table entries evenly over the search table, but there is a possibility that many table entries may hashed into the same bucket. Thus, using 100 percent of a table is not practical, and the size of the table often needs to be much larger than the typical number of table entries.
In the field of data communications, there are many applications wherein each of a plurality of searching agents is required to search a single table of information. In routing and switching devices, a table of information is often used to provide a mapping mechanism for forwarding data, typically in the form of a packet (e.g., an Ethernet Packet), from one location to another location.
As packets arrive at each of a plurality of associated ports of a switch or router device, a plurality of port searching agents, each associated with one of the ports, must search information stored in the table to determine an appropriate action. For example, if the table includes an entry providing a direction for the arrived packet, the device forwards the packet in the direction indicated. If the table does not include an entry providing a direction for the arrived packet, the device may handle the packet based on a default setting. Examples of default settings include sending the packet to all available ports (broadcasting), sending the packet to a central processing unit (CPU) for analysis in accordance with a predefined set of rules, or dropping the packet. For Ethernet routing applications, a table of information is typically organized based on particular fields (e.g., a medium access control (MAC) Address, an IP Address, a Virtual LAN ID, etc.) of a packet. When particular fields of the packet match particular fields of the table, the device utilizes the corresponding information in the table to forward the packet.
In conventional table searching systems wherein each of a plurality searching agents is required to search a single table of information, a xe2x80x9cpullxe2x80x9d searching method is typically employed wherein each of the searching agents is required to initiate table searching. An arbitration scheme is usually employed to resolve requests initiated by each of a plurality of searching agents for access to the single table.
FIG. 1 shows a generalized block diagram of a conventional table information searching system at 10, the system operating in accordance with conventional pull search techniques. The system 10 includes a plurality of N+1 searching agents 12 designated AGENT_0, AGENT_1, . . . AGENT_N. As an example, each of the searching agents 12 may be a port agent communicatively coupled with a receiving port of a switching device. Each of the searching agents 12 includes: a receiver port 14 for receiving a search key (e.g., a destination address of a data jacket); an arbitration request signal output port 16 for providing one of a plurality of N+1 request signals designated REQ_0, REQ_1 . . . REQ_N; an arbitration grant signal input port 18 for receiving an associated one of a plurality of N+1 grant signals designated GNT_0, GNT_1 . . . GNT_N; a table data input port 20 for receiving table information via a table data bus 21 as further explained below; and a memory address output port 22 for providing address values to a search address bus 23 as further explained below.
The system 10 further includes; an arbitration logic unit 26 having a plurality of request signal input ports 28 for receiving associated ones of the arbitration request signals, and a plurality of N+1 arbitration grant signal output ports 30 each providing an associated one of the arbitration grant signals to port 18 of an associated one of the agents 12; and a table information memory unit 36 for storing a table of information, and having a table data output port 38 for providing table data to the table data input port 20 of selected ones of the searching agents 12 via the bus 21, and a search address input port 40 for receiving the memory address values from the ports 22 of selected ones of the agents 12.
The table information memory unit 36 is typically implemented using static random access memory (SRAM) technology, and therefore only one of the entries of the table of information stored therein may be accessed at a time. Because of this fundamental feature of SRAM technology, only one of the agents 12 may access the table information unit 36 at a time. However, each of the agents 12 may have a different search key value for searching the table stored in the memory unit 36, and therefore there is a conflict.
Because only one of the table entries stored in the memory unit 36 may be accessed at a time, the arbitration logic unit 26 is needed to arbitrate among requests received from the searching agents 12 for access to the memory unit. The arbitration logic unit 26 receives and resolves the requests, and provides the grant to select corresponding ones of the searching agents 12. In response to the associated one of the grant signals being asserted, a selected searching agents 12 begins to provide one or more address values sequentially to port 40 of the memory unit 36 via the bus 23. In response to each of the address values, the memory unit provides the contents of a table entry stored at the specified address, to all the agents via the data bus, although only selected agents process the data from the memory. Each of the agents is operative to execute a searching process to determine a match between the search key value and one of the table entries. If the searching system needs to search every table entry to determine a best available match, instead of an exact match, the required search time becomes very lengthy.
A problem associated with the prior art table searching system 10 is that the system is not scalable to a large number of searching agents 12 because only one of the agents 12 may access the table information unit 36 at a given time, and so the total required search time for processing all the search key increases linearly as the number of searching agents increases because only one search key can be processed at a time in accordance with xe2x80x9cpullxe2x80x9d search techniques. Stated alternatively, the total number of cycles required for searching is proportional to the number of searching agents.
For example, in a switching device, as the number of port searching agents (each having a different destination address of an associated incoming packet) increases linearly, the required search time increases linearly because only one packet can be processed at a time in accordance with xe2x80x9cpullxe2x80x9d search techniques. This becomes a major performance bottleneck when the switching device requires the processing of a large number of packets simultaneously. For example, if the minimum packet forwarding time is 80 clock cycles and the maxim search time is eight clock cycles, the switching device can forward a maximum of ten packets at the same time. If the switching device needs to forward more than ten packets at the same time, then search table using a xe2x80x9cpullxe2x80x9d search technique becomes a performance bottleneck. This is especially crucial if the maximum search time is very large. If the searching system needs to search every table entry to determine a best available match, instead of an exact match, the search time for processing multiple packets is quite lengthy.
It is an object of the present invention to provide a method and apparatus for facilitating high speed linear searching of a table of information by a plurality of searching agents that are each required to search the contents of many entries of the table using different search keys.
It is also an object of the present invention to provide a high performance and cost effective method and apparatus for facilitating high speed linear searching of a table by a plurality of searching agents.
It is a further object of the present invention to provide a method and apparatus for facilitating high speed linear searching of a table of information by a plurality of agents wherein the number of searching agents is easily scalable without sacrificing searching performance.
In one embodiment, the present invention is directed to a table searching method. In the method, at least one memory unit is provided having a table of information including a plurality of data entries and a plurality of searching agents are provide with each agent being communicatively coupled with the memory unit. Each of the searching agents receives an associated search value and also receives a table entry from the plurality of data entries. The agents process the table entry to determine if a match occurs between the associated search value and the table entry.
In addition, the table searching method is applicable when the memory unit has a plurality of tables and the agents receive both the table entry and a table address associated a selected table of the plurality of tables. The match determination can be accomplished as an associated best matching of a plurality of table entries in accordance with a longest prefix match searching process or a policy match searching process.
The table searching method also provide a controller unit that controls the memory unit and provides a series of memory address values to the memory unit by the controller unit. In that case, the table entries received by each of the agents are based on the memory address values. In addition, each of the agents is communicatively coupled with the controller unit and each of the agents provides a search enable signal to the controller unit in response to receiving the associated search value. Thus, the controller unit does not provide the series of memory address values until a search enable signal is received from at least one of the agents.
In one embodiment, the present invention is directed to a table searching method In the method, at least one memory unit is provided having a table of information including a plurality of data entries and a plurality of searching agents are provide with each agent being communicatively coupled with the memory unit. A table entry from the plurality of data entries is broadcast by the at least one memory unit to each of the agents wherein each of the searching agents determines if a match occurs between the associated search value and the table entry.
The present invention is also directed to a table searching system including: a memory unit for storing a table of information including a plurality of data entries each having data contents; a plurality of searching agents each being communicatively coupled with the memory unit, and having a port for receiving an associated search key value; and a memory controller unit providing a surface interface between the memory unit and each of the agents. The controller unit is operative to control the memory unit to provide the contents of a current one of the table entries to each of the agents during each of a plurality of cycles of operation. Each of the searching agents is operative to determine an associated best matching one of the data entries based on comparisons between the associated key value and the contents of the data entries provided by the memory unit.
In one embodiment of the present invention, each of the searching agents is operative to determine the associated best matching one of the data entries in accordance with a longest prefix match searching process. In another embodiment of the present invention, each of the searching agents is operative to determine the associated best matching one of the data entries in accordance with a policy match searching process.
The controller unit controls the memory unit by providing a series of memory address values to the memory unit. The memory unit is responsive to the memory address values, and operative to provide the contents of one of the table entries to each of the agents during each of the cycles.
An important advantage of the broadcast linear search method and apparatus of the present invention is that it solves the performance bottleneck problem associated with table searching by using push searching techniques wherein multiple packets can be searched and forwarded at the same time. In accordance push searching techniques, as the number of searching agents increases, the total search time stays constant. This method is ideal when multiple agents must search a same field in a given period of time. For example, each agent must search each of the table entries to determine a best match when the priority of best match is not in order.
The above and other objects, features and advantages of the invention will become apparent from the following description of the preferred embodiment taken in conjunction with the accompanying drawings.